<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="base.jsp" %>
<!-- sidebar开始 -->
		<div id="sidebar">
			<div id="sidebar-wrapper">
				<h1 id="sidebar-links">
					<a href="index.jspx">New Mine</a>
				</h1>
				<a href="${basePath}/index.jspx">
					<img src="${basePath}/images/logo.png" alt="New Mine logo" id="logo" />
				</a>
				<div id="profile-links">
					您好,<a href="#" title="Edit your profile">${sessionScope.user.name}</a>
					, 您有
					<a title="3 Messages" ref="model" href="#messages">3条新消息</a>
					<br />
					<br />
					<a title="View the Site" href="${basePath}/index.jspx">首页</a>
					|
					<a href="${basePath}/user!quit.jspx">退出</a>
				</div>
				<ul id="main-nav">
					<li>
						<a id="main-nav-a-new" href="${basePath}/project!input.jspx" class="nav-top-item no-submenu">新建项目</a>
					</li>
					<li>

						<a id="main-nav-a-list" href="#" class="nav-top-item">项目列表</a>
						<ul id="projectlist">
						</ul>
					</li>
					<script type="text/javascript">
						$(document).ready(function(){
							var flag = ${project != null} || ${issues != null} || ${milestone != null} || ${document != null};
							var project_id;
							if(${project != null}) {
								project_id = ${project.id}+0;
							} else if(${issues != null}) {
								project_id = ${issues.project.id}+0;
							} else if(${milestone != null}) {
								project_id = ${milestone.project.id}+0;
							} else if(${document != null}) {
								project_id = ${document.project.id}+0;
							}
							$.get("${basePath}/project!ajaxlist.jspx",function(json){
								$(json).each(function(){
									if(flag) {
										if(project_id == this.id) {
											$("#projectlist").append('<li><a class="current" href="${basePath}/project.jspx?id='+this.id+'">'+this.name+'</a></li>');
										} else {
											$("#projectlist").append('<li><a href="${basePath}/project.jspx?id='+this.id+'">'+this.name+'</a></li>');
										}
									} else {
										$("#projectlist").append('<li><a href="${basePath}/project.jspx?id='+this.id+'">'+this.name+'</a></li>');
									}
								});
							});
							if(project_id > 0) {
								$.get("${basePath}/project!ajaxuserlist.jspx","id="+project_id,function(json){
									$(json).each(function(){
										$("#userlist").append('<li><a href="${basePath}/user.jspx?id='+this.id+'">'+this.name+'</a></li>');
									});
								});
							}
						});
						
					</script>
					<li>
						<a  href="#" class="nav-top-item tip" title="该项目所有成员">项目成员</a>
						<ul id="userlist">
						</ul>
					</li>
					<li>
						<a id="main-nav-a-report" href="${basePath}/project!report2.jspx" class="nav-top-item no-submenu">项目统计</a>
					</li>
				</ul>
				<div id="messages" style="display: none;">
					<p>
						<strong>日期</strong>
						by who
						<br />
						内容
						
					</p>
				</div>
			</div>
		</div>
		<!-- sidebar结束 -->